﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Color x:Key="MainColor">White</Color>
    <Color x:Key="LightColor">#FF8ACA06</Color>
    <Color x:Key="BackgroundLightColor">#5D8ACA06</Color>
    <Color x:Key="DarkColor">Green</Color>
    <Color x:Key="ForegroundColor">#FF007000</Color>
    <Color x:Key="FontColor">#BD003400</Color>

    <SolidColorBrush x:Key="MainBrush" Color="{StaticResource MainColor}" />
    <SolidColorBrush x:Key="LightBrush" Color="{StaticResource LightColor}" />
    <SolidColorBrush x:Key="BackgroundLightBrush" Color="{StaticResource BackgroundLightColor}" />
    <SolidColorBrush x:Key="BtnMouseOver" Color="#FFFFAF00" />
    <!--<SolidColorBrush x:Key="ForegroundBrush" Color="#FF696969" />-->
    <SolidColorBrush x:Key="ForegroundBrush" Color="{StaticResource ForegroundColor}" />
    <SolidColorBrush x:Key="DarkBrush" Color="Green" />
    <SolidColorBrush x:Key="FontBrush" Color="{StaticResource FontColor}" />

    <SolidColorBrush x:Key="DisabledForegroundBrush" Color="Black" />
    <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#FFEEEEEE" />

    <SolidColorBrush x:Key="LableForegroundBrush" Color="#9F000000" />
    
    <SolidColorBrush x:Key="ErrorLightBrush" Color="Red" />


    <SolidColorBrush x:Key="DisabledBorderBrush" Color="{StaticResource DarkColor}" />

    <Color x:Key="SelecteBackgroundColor">#5D8ACA06</Color>

    <Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}">
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="MinHeight" Value="23" />
        <Setter Property="AllowDrop" Value="True" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Margin" Value="0,2,2,2" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Border Name="Border" CornerRadius="4" Padding="2" 
                                Background="{StaticResource MainBrush}"
                                BorderBrush="{StaticResource LightBrush}"
                                BorderThickness="1">
                        <ScrollViewer Margin="0" x:Name="PART_ContentHost" />
                    </Border>
                    <!--<Image Name="ErrorIcon" VerticalAlignment="Top" HorizontalAlignment="Right" Width="16" Height="16" Margin="0,-8,-8,0" Source="/WpfApplication1;component/ErrorImage.jpg" Opacity="0" ToolTip="{Binding Path=(Validation.Errors)[0].ErrorContent}" />-->
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource LightBrush}" />
                            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource ErrorLightBrush}" />
                            <Setter Property="Foreground" Value="{StaticResource ErrorLightBrush}" />
                            <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="CornerRadius" Value="0" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="Border" Property="CornerRadius" Value="0" />
                        </Trigger>
                        <!--<Trigger Property="Validation.HasError" Value="True">
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource ErrorLightBrush}" />
                            <Setter Property="Foreground" Value="{StaticResource ErrorLightBrush}" />
                            <Setter TargetName="ErrorIcon" Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                            <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation Storyboard.TargetName="Border" Storyboard.TargetProperty="BorderBrush" From="#FF8ACA06" To="Red" Duration="00:00:.5" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="ErrorIcon" Storyboard.TargetProperty="Opacity" From="1.0" To="0.0" Duration="00:00:.5" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>-->
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate TargetType="Control"></ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ButtonFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border CornerRadius="4" BorderThickness="1" BorderBrush="{StaticResource LightBrush}">
                        <Rectangle x:Name="MyBorder" Margin="0" StrokeThickness="1" Stroke="{StaticResource LightBrush}" StrokeDashArray="2 4" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type Button}" TargetType="{x:Type Button}">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="MinWidth" Value="75"/>
        <Setter Property="Foreground" Value="{StaticResource DarkBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border x:Name="Border" CornerRadius="4" BorderThickness="1" Background="{StaticResource MainBrush}" BorderBrush="{StaticResource LightBrush}">
                        <ContentPresenter Margin="2" HorizontalAlignment="Center" VerticalAlignment="Center" RecognizesAccessKey="True"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsDefaulted" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="#5D8ACA06" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="CornerRadius" Value="0" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource LightBrush}" />
                            <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" />
                            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type Label}" TargetType="{x:Type Label}">
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="FontFamily" Value="Tahoma" />
        <Setter Property="Foreground" Value="{StaticResource LableForegroundBrush}" />
    </Style>

    <Style x:Key="ModuleHeaderStyle" TargetType="{x:Type TreeViewItem}">
        <Setter Property="Background" Value="{StaticResource ResourceKey=MainBrush}" />
        <Setter Property="Foreground" Value="{StaticResource ResourceKey=ForegroundBrush}" />
        <Setter Property="FontSize" Value="22" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <!--<ColumnDefinition MinWidth="19" Width="Auto" />-->
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource ResourceKey=SelecteBackgroundColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="SelectedInactive" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ExpansionStates">
                                <VisualState x:Name="Expanded">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="(UIElement.Visibility)">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="Width">
                                            <EasingDoubleKeyFrame KeyTime="00:00:0.5" Value="250" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <!--<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                                <EasingColorKeyFrame KeyTime="00:00:0.5" Value="#5D8ACA06" />
                                            </ColorAnimationUsingKeyFrames>-->
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="Width">
                                            <EasingDoubleKeyFrame KeyTime="00:00:0.5" Value="200" />
                                        </DoubleAnimationUsingKeyFrames>
                                        <!--<ColorAnimationUsingKeyFrames Storyboard.TargetName="Bd" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                                <EasingColorKeyFrame KeyTime="00:00:0.5" Value="#FFFFFFFF" />
                                            </ColorAnimationUsingKeyFrames>-->
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Border x:Name="Bd" Grid.Column="0" 
                                    CornerRadius="0,15,5,0" Margin="0,5,0,0" Padding="10,0,0,0" Width="200" Height="50"
                                    Background="{StaticResource MainBrush}" 
                                    BorderBrush="{StaticResource LightBrush}" 
                                    BorderThickness="0,5,5,5">
                            <ContentPresenter x:Name="PART_Header" ContentSource="Header" VerticalAlignment="Center" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
                        </Border>
                        <ItemsPresenter x:Name="ItemsHost" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Visibility="Collapsed" />
                    </Grid>

                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="True">
                            <Setter TargetName="Bd" Property="Background" Value="#5D8ACA06" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="HasHeader" Value="False" />
                                <Condition Property="Width" Value="Auto" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="HasHeader" Value="False" />
                                <Condition Property="Height" Value="Auto" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ModuleItemStyle" TargetType="{x:Type TreeViewItem}">
        <Setter Property="Background" Value="{StaticResource MainBrush}" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="FontSize" Value="12" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Selected" />
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="SelectedInactive" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Bd" Grid.Column="0" CornerRadius="0,10,5,0" Background="{StaticResource MainBrush}"
                                    BorderBrush="{StaticResource LightBrush}" BorderThickness="1" Width="175"
                                    Padding="10,2,0,2" Margin="10,2,0,0">
                            <ContentPresenter x:Name="PART_Header" ContentSource="Header" VerticalAlignment="Center" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
                            <Setter TargetName="Bd" Property="Background" Value="{StaticResource LightBrush}" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="HasHeader" Value="False" />
                                <Condition Property="Width" Value="Auto" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="HasHeader" Value="False" />
                                <Condition Property="Height" Value="Auto" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ModuleNavigatorStyle" TargetType="TreeView">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TreeView">
                    <Border Name="Border" CornerRadius="0" BorderThickness="0">
                        <ScrollViewer Focusable="False" CanContentScroll="False" Padding="0">
                            <ItemsPresenter />
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type UserControl}" TargetType="{x:Type UserControl}">
        <Setter Property="FlowDirection" Value="LeftToRight" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="VerticalAlignment" Value="Stretch" />
    </Style>

    <ContextMenu x:Key="OperationsMenu" x:Name="OperationsMenu">
        <MenuItem Header="File">
            <MenuItem Header="Save" Command="{Binding Path=SaveCommand}" />
            <MenuItem Header="Save And New" Command="{Binding Path=SaveAndNewCommand}" />
            <MenuItem Header="Save And Close" Command="{Binding Path=SaveAndCloseCommand}" />
            <Separator />
            <MenuItem Header="Delete" />
            <Separator />
            <MenuItem Header="Print" />
            <Separator />
            <MenuItem Header="Close" Command="{Binding Path=CloseEditorCommand}" />
        </MenuItem>
    </ContextMenu>

    <Style x:Key="WindowStyle" TargetType="{x:Type Window}">
        <Setter Property="FlowDirection" Value="RightToLeft" />
        <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
        <Setter Property="Background" Value="{StaticResource MainBrush}" />
        <Setter Property="Padding" Value="5" />
        <Setter Property="WindowStyle" Value="None" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Title" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.Title}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Window}">
                    <Grid Background="{TemplateBinding Background}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="35" />
                            <ColumnDefinition Width="2" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="55" />
                            <RowDefinition Height="1" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <Grid Grid.Column="2" Grid.Row="0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Label Content="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.Title}" Grid.Column="0" VerticalContentAlignment="Center" FontFamily="Sakkal Majalla" FontSize="36" Foreground="{StaticResource LableForegroundBrush}" />
                            <Label Grid.Column="1" VerticalContentAlignment="Center">
                                <TextBlock FontFamily="Tahoma" FontSize="11" Foreground="{StaticResource LableForegroundBrush}" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.Description}" TextWrapping="Wrap" />
                            </Label>
                        </Grid>

                        <!--#BD003400-->
                        <Rectangle Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2" Height="1" Margin="5,0,5,0" Name="rectangle1" Stroke="{StaticResource LightBrush}" />

                        <Border Name="CaptionBorder" Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" HorizontalAlignment="Left" Margin="5,5,0,5" Width="30" 
                                CornerRadius="4" BorderThickness="1" BorderBrush="{StaticResource LightBrush}" Background="{StaticResource BackgroundLightBrush}">
                            <Grid>
                                <StackPanel Orientation="Vertical" VerticalAlignment="Top">
                                    <Button x:Name="OperationsMenuButton" Width="20" Height="20" Margin="0,5,0,0" Focusable="False" IsEnabled="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.IsOperationEnabled}">
                                        <Button.Style>
                                            <Style TargetType="{x:Type Button}">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type Button}">
                                                            <Rectangle Fill="Beige" Stroke="{StaticResource LightBrush}" Width="10" Height="10" ContextMenu="{StaticResource OperationsMenu}" />
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Button.Style>
                                    </Button>
                                </StackPanel>

                                <StackPanel Orientation="Vertical" VerticalAlignment="Bottom">
                                    <Button x:Name="MinButton" Width="20" Height="20" Margin="0" Focusable="False">
                                        <Button.Style>
                                            <Style TargetType="{x:Type Button}">
                                                <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.MinimizeVisibility}" />
                                                <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.IsMinimizeEnabled}" />
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type Button}">
                                                            <Grid Background="Transparent">
                                                                <Border BorderThickness="0" />
                                                                <Rectangle x:Name="minRect" Height="2" RadiusX=".5" RadiusY=".5" Fill="{StaticResource LightBrush}" Margin="1,5" />
                                                            </Grid>
                                                            <ControlTemplate.Triggers>
                                                                <Trigger Property="IsMouseOver" Value="True">
                                                                    <Setter Property="Fill" TargetName="minRect" Value="#FFB58110"/>
                                                                </Trigger>
                                                                <Trigger Property="IsEnabled" Value="False">
                                                                    <Setter TargetName="minRect" Property="Fill" Value="Silver" />
                                                                </Trigger>
                                                            </ControlTemplate.Triggers>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Button.Style>
                                    </Button>

                                    <ToggleButton x:Name="MaxAndNormalButton" Width="20" Height="20" Margin="0,7" Focusable="False">
                                        <ToggleButton.Style>
                                            <Style TargetType="{x:Type ToggleButton}">
                                                <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.MaximizeVisibility}" />
                                                <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=DataContext.ViewInfo.IsMaximizeEnabled}" />
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                            <Grid Background="Transparent">
                                                                <VisualStateManager.VisualStateGroups>
                                                                    <VisualStateGroup x:Name="CommonStates">
                                                                        <VisualState x:Name="Normal" />
                                                                        <VisualState x:Name="MouseOver">
                                                                            <Storyboard>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect1" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect2" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect3" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect4" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                        <VisualState x:Name="Pressed" />
                                                                        <VisualState x:Name="Disabled">
                                                                            <Storyboard>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect1" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="Silver" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect2" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="Silver" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="Silver" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect3" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="Silver" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                                <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect4" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                    <EasingColorKeyFrame KeyTime="0" Value="Silver" />
                                                                                </ColorAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                    </VisualStateGroup>
                                                                    <VisualStateGroup x:Name="CheckStates">
                                                                        <VisualState x:Name="Checked">
                                                                            <Storyboard>
                                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas1" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
                                                                                </ObjectAnimationUsingKeyFrames>
                                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas2" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                                    <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                                                                </ObjectAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                    </VisualStateGroup>
                                                                </VisualStateManager.VisualStateGroups>
                                                                <Border BorderThickness="1">
                                                                    <Grid>
                                                                        <Canvas x:Name="canvas1" Margin="3,3,3,3">
                                                                            <Rectangle x:Name="rect1" Width="12" Height="12" Canvas.Left="0.011" Canvas.Top="0.066" Stroke="{StaticResource LightBrush}" />
                                                                            <Rectangle x:Name="rect2" Width="12" Height="4" Stroke="{StaticResource LightBrush}" Fill="{StaticResource LightBrush}" />
                                                                        </Canvas>
                                                                        <Canvas x:Name="canvas2" Margin="3,3,3,3" Visibility="Collapsed">
                                                                            <Rectangle x:Name="rect3" Width="8" Height="8" Canvas.Left="1" Canvas.Top="1" Stroke="{StaticResource LightBrush}" />
                                                                            <Rectangle x:Name="rect4" Width="8" Height="8" Canvas.Left="3" Canvas.Top="3" Stroke="{StaticResource LightBrush}" />
                                                                        </Canvas>
                                                                    </Grid>
                                                                </Border>
                                                            </Grid>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </ToggleButton.Style>
                                    </ToggleButton>

                                    <Button x:Name="CloseButton" Width="20" Height="20" Margin="0,5,0,0" Focusable="False">
                                        <Button.Style>
                                            <Style TargetType="{x:Type Button}">
                                                <Setter Property="Visibility" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.CloseVisibility}" />
                                                <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.IsCloseEnabled}" />
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type Button}">
                                                            <Grid Background="Transparent">
                                                                <Border BorderThickness="1" Background="#00000000">
                                                                    <Path x:Name="closePath" Width="10" Height="10" Data="M0.28710935,3.5868225 L1.3359375,3.5868225 L3.515625,6.7626038 L3.5390625,6.7626038 L5.7070313,3.5868225 L6.7675781,3.5868225 L4.1074219,7.4481506 L6.890625,11.426666 L5.8183594,11.426666 L3.5214844,8.1044006 L3.4980469,8.1044006 L1.2011719,11.426666 L0.11718747,11.426666 L2.9238281,7.4247131 z" Fill="{StaticResource LightBrush}" RenderTransformOrigin=".5,.5" Stretch="Fill" />
                                                                </Border>
                                                            </Grid>
                                                            <ControlTemplate.Triggers>
                                                                <Trigger Property="IsMouseOver" Value="True">
                                                                    <Setter TargetName="closePath" Property="Fill" Value="#FFFFAF00"/>
                                                                </Trigger>
                                                                <Trigger Property="IsEnabled" Value="False">
                                                                    <Setter TargetName="closePath" Property="Fill" Value="Silver" />
                                                                </Trigger>
                                                            </ControlTemplate.Triggers>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </Button.Style>
                                    </Button>
                                </StackPanel>
                            </Grid>
                        </Border>

                        <Border Grid.Column="2" Grid.Row="3" Margin="5" BorderThickness="0">
                            <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="False" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="HeaderStyle" TargetType="{x:Type TabItem}">
        <Setter Property="Header" Value="{Binding Path=DataContext.BrowserInfo.Title}" />
        <Setter Property="Foreground" Value="{StaticResource FontBrush}" />
        <Setter Property="FontFamily" Value="Microsoft Sans Serif" />
        <Setter Property="FontSize" Value="12" />
        <!--<Setter Property="FontWeight" Value="Bold" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid x:Name="Root">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="SelectionStates">
                                <VisualState x:Name="Unselected" />
                                <VisualState x:Name="Selected">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource LightColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderThickness)" Storyboard.TargetName="Border">
                                            <EasingThicknessKeyFrame KeyTime="0" Value="1,1,1,0" />
                                        </ThicknessAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource BackgroundLightColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource DarkColor}"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="Border" Margin="0,0,-4,0" BorderThickness="1,1,1,1" CornerRadius="2,12,0,0" BorderBrush="{StaticResource LightBrush}" Background="{StaticResource MainBrush}">
                            <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header" Margin="12,2,12,2" RecognizesAccessKey="True" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Panel.ZIndex" Value="100" />
                            <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="20" />
            </Grid.ColumnDefinitions>
            <Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="4" BorderThickness="1" Margin="0" 
                    Background="{StaticResource MainBrush}" BorderBrush="{StaticResource LightBrush}" />

            <Border x:Name="TextBorder" Grid.Column="0" CornerRadius="4,0,0,4" Margin="1" BorderThickness="0" Background="{StaticResource MainBrush}" />

            <Border x:Name="GlyphBorder" Grid.Column="1" CornerRadius="0,4,4,0" BorderThickness="1" Margin="0,2,2,2" BorderBrush="{StaticResource LightBrush}">
                <Path x:Name="Arrow" Fill="{StaticResource LightBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z" />
            </Border>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="ToggleButton.IsMouseOver" Value="True">
                <Setter TargetName="Border" Property="CornerRadius" Value="0" />
                <Setter TargetName="GlyphBorder" Property="CornerRadius" Value="0" />
            </Trigger>
            <Trigger Property="ToggleButton.IsChecked" Value="true">
                <Setter TargetName="GlyphBorder" Property="Background" Value="{StaticResource LightBrush}" />
                <Setter TargetName="Arrow" Property="Fill" Value="{StaticResource MainBrush}" />
                <Setter TargetName="Border" Property="CornerRadius" Value="4,4,0,0" />
                <Setter TargetName="GlyphBorder" Property="CornerRadius" Value="0,4,0,0" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter TargetName="Border" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
                <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource LightBrush}" />
                <Setter TargetName="TextBorder" Property="Background" Value="{StaticResource DisabledBackgroundBrush}" />
                <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                <Setter TargetName="Arrow" Property="Fill" Value="{StaticResource DisabledForegroundBrush}" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox">
        <Border x:Name="PART_ContentHost" Focusable="False" Background="{StaticResource MainBrush}" />
    </ControlTemplate>

    <Style x:Key="{x:Type ComboBox}" TargetType="ComboBox">
        <Setter Property="SnapsToDevicePixels" Value="true"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="MinWidth" Value="120"/>
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="Foreground" Value="{StaticResource DarkBrush}" />
        <Setter Property="Margin" Value="0,2,2,2" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBox">
                    <Grid>
                        <ToggleButton Name="ToggleButton" Grid.Column="2" Focusable="false" ClickMode="Press" Template="{StaticResource ComboBoxToggleButton}" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
                        <ContentPresenter Name="ContentSite" IsHitTestVisible="False" Margin="3,3,23,3" HorizontalAlignment="Left" VerticalAlignment="Center" 
                                              Content="{TemplateBinding SelectionBoxItem}"
                                              ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                              ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" />

                        <TextBox x:Name="PART_EditableTextBox" Style="{x:Null}" Margin="3,3,23,3" Focusable="True" Visibility="Hidden" HorizontalAlignment="Left" VerticalAlignment="Center" IsReadOnly="{TemplateBinding IsReadOnly}"
                                     Template="{StaticResource ComboBoxTextBox}" Background="{StaticResource MainBrush}" Foreground="{StaticResource ForegroundBrush}"  />

                        <Popup Name="Popup" AllowsTransparency="True" Focusable="False" Placement="Bottom" PopupAnimation="Fade" IsOpen="{TemplateBinding IsDropDownOpen}">
                            <Grid Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
                                <Border x:Name="DropDownBorder" Background="{StaticResource MainBrush}" BorderThickness="1" BorderBrush="{StaticResource LightBrush}" />
                                <ScrollViewer Margin="0,2,0,6" SnapsToDevicePixels="True">
                                    <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasItems" Value="false">
                            <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                        <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="True">
                            <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="0,0,4,4"/>
                            <Setter TargetName="DropDownBorder" Property="Margin" Value="0,-1,0,0"/>
                        </Trigger>
                        <Trigger Property="IsEditable" Value="True">
                            <Setter Property="IsTabStop" Value="False"/>
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type ComboBoxItem}" TargetType="ComboBoxItem">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ComboBoxItem">
                    <Border Name="Border" Padding="2,0,2,0" SnapsToDevicePixels="True">
                        <ContentPresenter />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{StaticResource LightBrush}"/>
                            <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>